[global/wm]
margin-bottom = 0

[settings]
throttle-output = 5
throttle-output-for = 10
screenchange-reload = true
compositing-background = over
compositing-foreground = over
compositing-overline = over
compositing-underline = over
compositing-border = over

[colors]
background = #263238
foreground = #d0d3d4

################################################################################
################################################################################
############                  MAINBAR-BSPWM                         ############
################################################################################
################################################################################
[bar/mainbar-bspwm]
override-redirect = false
bottom = false
fixed-center = true
width = 100%
height = 25
border-size = 0
line-size = 2
line-color = #000000

; Enable support for inter-process messaging
; See the Messaging wiki page for more details.
enable-ipc = true

;Hide Polybar on fullscreen apps
wm-restack = bspwm

font-0 = "Noto Sans:size=10;0"
font-1 = FontAwesome:style=Regular:pixelsize=10;1
font-2 = "Noto Sans:size=10;0"
font-3 = "Noto Sans Mono:size=10;0
font-4 = Font Awesome 6 Free Solid:style=Solid:size=10;1

tray-position = right
tray-detached = false
tray-offset-x = 0
tray-offset-y = 0
tray-padding = 2
tray-maximize = 25
tray-scale = 1.0
tray-background = ${colors.background}

padding-left = 0
padding-right = 4

module-margin-left = 3
module-margin-right = 3

modules-left = bspwm xwindow
modules-center = cmus
modules-right = xkeyboard temperature cpu memory pulseaudio powermenu date

separator = |

background = ${colors.background}

################################################################################
################################################################################
############                       MODULE BSPWM                     ############
################################################################################
################################################################################

[module/bspwm]
type = internal/bspwm

enable-click = true
enable-scroll = true
reverse-scroll = true
pin-workspaces = true

ws-icon-0 = 1; 
ws-icon-1 = 2;
ws-icon-2 = 3; 
ws-icon-3 = 4; 
ws-icon-4 = 5; 
ws-icon-5 = 6;
ws-icon-6 = 7; 
ws-icon-default = " "


format = <label-state> <label-mode>

label-focused = %icon%
label-focused-background = #4b4e51
label-focused-underline= #5294E2
label-focused-padding = 4
label-focused-foreground = ${colors.foreground}

label-occupied = %icon%
label-occupied-padding = 3
label-occupied-margin = 1
label-occupied-background = ${colors.background}
label-occupied-underline = #4b4e51

label-urgent = %icon%
label-urgent-padding = 3

label-empty = %icon%
label-empty-padding = 3
label-empty-background = ${colors.background}
#label-monocle = "  "
#label-tiled = "  "
#label-fullscreen = "  "
#label-floating = "  "
#label-pseudotiled = "  "
#label-locked = "  "
#label-sticky = "  "
#label-private =  "     "

; Separator in between workspaces
;label-separator = |
;label-separator-padding = 10
;label-separator-foreground = #ffb52a

format-background = ${colors.background}
format-foreground = ${colors.foreground}

################################################################################

[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #5294E2
label = %percentage:2%%

################################################################################

[module/date]
type = internal/date
interval = 5

date =
date-alt = " %Y-%m-%d"

time = %H:%M
time-alt = %H:%M:%S

format-prefix = 
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #5294E2

label = %date% %time%

################################################################################

[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #5294E2
label = %percentage_used%%

################################################################################

[module/pulseaudio]
type = internal/pulseaudio
interval = 5
click-right = pavucontrol
format-volume = <ramp-volume> <label-volume>
format-volume-underline = #5294E2
ramp-volume-foreground = #aabec4
ramp-volume-0 = 
ramp-volume-1 =  
ramp-volume-2 = 

################################################################################

[module/weather]
type = custom/script
interval = 10
format = <label>
format-prefix = " "
format-prefix-foreground = #aabec4
format-background = ${colors.background}
format-underline = #5294E2
exec = python3 -u ~/.config/polybar/scripts/weather.py
tail = true

#################################################################################

[module/xkeyboard]
;https://github.com/jaagr/polybar/wiki/Module:-xkeyboard
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-background = ${colors.background}
format-underline = #5294E2

label-layout = %layout%
label-indicator-background = ${colors.background}

################################################################################

[module/xwindow]
;https://github.com/jaagr/polybar/wiki/Module:-xwindow
type = internal/xwindow

; Available tokens:
;   %title%
; Default: %title%
label = %title%
label-maxlen = 50

format-background = ${colors.background}
format-underline = #5294E2

################################################################################

[module/powermenu]
type = custom/menu
expand-right = true
format-spacing = 1
format-underline = #5294E2
label-open = ""
label-open-foreground = #ECEFF4
label-close = " Close"
label-close-foreground = #EBCB8B
#label-separator = |
label-separator-foreground = #A3BE8C


menu-0-0 = "Reboot"
menu-0-0-exec = menu-open-1
menu-0-1 = "Power off"
menu-0-1-exec = menu-open-2
menu-0-2 = "Log out"
menu-0-2-exec = menu-open-3


menu-1-0 = "Reboot"
menu-1-0-exec = systemctl reboot
menu-1-1-exec = menu-open-0


menu-2-0 = "Power off"
menu-2-0-exec = systemctl poweroff
menu-2-1-exec = menu-open-0


menu-3-0 = "Log out"
menu-3-0-exec = bspc quit
menu-3-1-exec = menu-open-0

##########################################################################################

[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60

format = <ramp> <label>
format-underline = #5294E2
format-warn = <ramp> <label-warn>
format-warn-underline = ${self.format-underline}

label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.secondary}

ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 
ramp-foreground = ${colors.foreground-alt}

###############################################################################################

[module/cmus]
type = custom/script

exec = ~/.config/polybar/scripts/cmus.sh
exec-if = pgrep -x cmus
interval = 1

click-left = cmus-remote --pause
click-right = cmus-remote --next
click-middle = cmus-remote --prev
scroll-up = cmus-remote --volume +5%
scroll-down = cmus-remote --volume -5%

label-font = 3
format = <label>
format-underline = #5294E2
label = %output%
label-maxlen = 50

